# name : exact test: Fisher, Barnards with nNewcombe CI
# key : freq.cmh.association
# contributor: Shuguang Sun
# --
** Newcombe is recommend by Fagerland2011 recom_confid_inter_for_two;
ods output pdiffcls=${7:pdiffci} (keep=riskdifference lowercl uppercl)
  FishersExact=${5:exact_fisher}
  BarnardsTest=${6:exact_barnards};
proc freq data = ${1:dtin};
  tables $0 ${4:stra} * ${2:trt} * ${3:response} / norow nocol nopercent
    chisq expected riskdiff(cl = newcombe);
  * weight count;
  exact barnard fisher;
run;

proc transpose data=$5
  out=${8:texact_fisher} (keep=xpl_fish xp2_fish);
  var nvalue1;
  id name1;
run;

proc transpose data=$6
  out=${9:texact_barnards} (keep=_rdif1_ xpl_rdif1 xp2_rdif1);
  var nvalue1;
  id name1;
run;

data mdd;
  merge $7 $8 $9;
run;
